php array start with index 0

39

//If you want to re-index starting to zero, simply do the following:
$iZero = array_values($arr);

//If you need it to start at one, then use the following:
$iOne = array_combine(range(1, count($arr)), array_values($arr));
$array = array("a","b","c");
array_unshift($array,"");
unset($array[0]);

Comments

Submit
0 Comments